//
//  LastStepViewController.m
//  QXShowing
//
//  Created by 王道道 on 2018/5/1.
//  Copyright © 2018年 doll_dream. All rights reserved.
//

#define foot_Height 120 *SizeScale

#import "LastStepViewController.h"

//#import "ApplyShowViewController.h"
#import "NewApplyShowViewController.h"

#import "BHSingleButton.h"

@interface LastStepViewController ()

@property (nonatomic, strong) UITextField *numberTF;
//@property (nonatomic, strong) UIButton *finishBtn;
@property (nonatomic, strong) BHSingleButton *finishBtn;

@end

@implementation LastStepViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"填写展位号";
    [self initNavBarBackBtn];
    
    [self setUpUI];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)setUpUI {
    self.view.backgroundColor = Bg_Color_F7F7F7;
    
    _numberTF = [[UITextField alloc] initWithFrame:CGRectMake(15, 35, App_Frame_Width-(15*2), 40)];
    _numberTF.layer.cornerRadius = 5;
    _numberTF.layer.masksToBounds = YES;
    _numberTF.backgroundColor = Bg_Color_FFFFFF;
    [self.view addSubview:_numberTF];
    
//    _finishBtn = [[UIButton alloc] initWithFrame:CGRectMake(10, App_Frame_Height-kNavbarAndStatusBar-200, App_Frame_Width-(10*2), 56)];
//    [_finishBtn setTitle:@"下一步（5/5）" forState:UIControlStateNormal];
//    _finishBtn.backgroundColor = Bg_Color_333333;
//    [_finishBtn setTitleColor:Text_Color_FFFFFF forState:UIControlStateNormal];
//    _finishBtn.titleLabel.font = [UIFont boldSystemFontOfSize:18 * SizeScale];
//    [_finishBtn addTarget:self action:@selector(finishAction) forControlEvents:UIControlEventTouchUpInside];
//    [self.view addSubview:_finishBtn];
    
    _finishBtn = [[BHSingleButton alloc] initWithFrame:CGRectMake(10, App_Frame_Height-kNavbarAndStatusBar-foot_Height, App_Frame_Width-(10*2), 60)];
    _finishBtn.button_name(@"下一步（5/5）");
    [_finishBtn addTarget:self action:@selector(finishAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_finishBtn];
}

- (void)finishAction {
    if([BHSettingUtil dataAndStringIsNull:self.numberTF.text]) {
        [[BHAlertUtil alertManager] showPromptInfo:@"请输入展位号"];
    }
    else {
        [self.showInfoArray replaceObjectAtIndex:4 withObject:self.numberTF.text];
        NewApplyShowViewController *pastVC = [self.navigationController.viewControllers objectAtIndex:self.navigationController.viewControllers.count-6];
        pastVC.showInfoArray = self.showInfoArray;
        [self.navigationController popToViewController:pastVC animated:true];
    }
}
@end
